(function() {
    App.set('$Event.login.toLogin', function() {
        var data = App.get('$Cache.login.info') || {};
        if (!data.username) {
            alert('warn', '请填写用户名');
            return;
        }
        if (!data.password) {
            alert('warn', '请填写密码');
            return;
        }
        coAjax.post(apis.admin.login, data, function(result) {
            App.set('loginer', result);
            alert('success', '登陆成功');
            Path.jump('/admin/main.html');
            console.log(result);
        }, function(errCode, err, errMsg) {
            console.log(errMsg);
        })
    })
}())
